package com.company;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;

/**
 * @author jrue
 * @description
 * @date 2019/11/15 10:37
 */
public class WordSubsets implements Runnable {

    private boolean flag = true;

    public static void main(String[] args) throws InterruptedException {
        WordSubsets wordSubsets = new WordSubsets();
        new Thread(wordSubsets).start();
        Thread.sleep(1000);
        wordSubsets.setFlag(false);

    }


    public static List<String> wordSubsets(String[] A, String[] B) {

        List<String> strings = new ArrayList<>();
        for (int i = 0; i < A.length; i++) {
            boolean flag = true;
            for (int j = 0; j < B.length; j++) {
                if (!A[i].contains(B[j])) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                strings.add(A[i]);
            }
        }

        return strings;
    }


    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    @Override
    public void run() {
        while (flag == true) {
            System.out.println("I am running");
        }
        System.out.println("I am dead");
    }
}
